<template>
    <view class="container">
        <header-bar :config="config"></header-bar>
        <scroll-view scroll-y>
            <select-department-tree v-if="depData" :data="depData" @selectFn="selectFn"></select-department-tree>
        </scroll-view>
    </view>
</template>

<script>
import selectDepartmentTree from "@/components/select/select-department-tree.vue"
import { GetFrameworkTree } from "@/service/api/store.js"
export default {
    components: {
        selectDepartmentTree,
    },
    data() {
        return {
            config: {
                title: "所属部门",
                centerSlot: true,
            },
            depData: null,
        }
    },
    mounted() {
        this.getFrameworkTree()
    },
    onShow() {},
    methods: {
        getFrameworkTree() {
            GetFrameworkTree({ level: 0 }).then((res) => {
                if (res.State == 1) {
                    console.log(res.Data)
                    this.depData = res.Data
                }
            })
        },
        selectFn(data) {
            const eventChannel = this.getOpenerEventChannel()
            eventChannel.emit("getSelectData", {
                ...data,
            })
            this.easyGoBack()
        },
    },
}
</script>

<style lang="scss"></style>
